package com.gmlive.common.sample.widgets

import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.gmlive.common.sample.R
import kotlinx.android.synthetic.main.activity_title_bar.*

class TitleBarActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_title_bar)

        title_bar_text_action.setTextAction("说明") {
            Toast.makeText(this, "右边按钮被点击", Toast.LENGTH_SHORT).show()
        }

        title_bar_icon_action.setIconAction(R.drawable.ic_action_question_dark) {
            Toast.makeText(this, "右边按钮被点击", Toast.LENGTH_SHORT).show()
        }

        title_bar_with_close.setExtraNavButton(true, R.drawable.ic_action_close_dark) {

        }

        val title = "这是一条长长的标题这是一条长长的标题这是一条长长的标题"
//        val title = "这是标题"

        ikTitle1.setIconAction(R.drawable.ic_action_question_dark) {}
//        ikTitle1.setTextAction("使用说明") {}
        ikTitle1.setNavButtonEnable(false)
        ikTitle1.setTitle(title)

        ikTitle2.setIconAction(R.drawable.ic_action_question_dark) {}
//        ikTitle2.setTextAction("使用说明") {}
        ikTitle2.setNavButtonEnable(false)
        ikTitle2.setExtraNavButton(true, R.drawable.ic_action_close_dark) {}
        ikTitle2.setTitle(title)

        ikTitle3.setIconAction(R.drawable.ic_action_question_dark) {}
//        ikTitle3.setTextAction("使用说明") {}
        ikTitle3.setNavButtonEnable(true)
        ikTitle3.setExtraNavButton(true, R.drawable.ic_action_close_dark) {}
        ikTitle3.setTitle(title)

        ikTitle4.setRightButtonEnable(false)
        ikTitle4.setNavButtonEnable(false)
        ikTitle4.setTitle(title)

        ikTitle5.setRightButtonEnable(false)
        ikTitle5.setNavButtonEnable(false)
        ikTitle5.setExtraNavButton(true, R.drawable.ic_action_close_dark) {}
        ikTitle5.setTitle(title)

        ikTitle6.setRightButtonEnable(false)
        ikTitle6.setNavButtonEnable(true)
        ikTitle6.setExtraNavButton(true, R.drawable.ic_action_close_dark) {}
        ikTitle6.setTitle(title)
    }
}
